package com.fessc.develop.job;

import com.fessc.develop.entity.dbvo.TPayment;
import com.fessc.develop.handler.CCBPrePaymentPushHandler;
import com.fessc.develop.model.enums.EnumPushType;
import com.fessc.develop.model.enums.EnumTaskCode;
import com.fessc.develop.service.interfaces.ITPaymentService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 建行订单清算结果查询推送
 */
@Slf4j
@Service
public class CCBPrePaymentStatusPushJob extends ScheduleJob{

    @Resource
    private ITPaymentService paymentService;

    @Resource
    private CCBPrePaymentPushHandler ccbPrePaymentPushHandler;

    @Override
    public String execute() {
        //获取推送银行的结果集
        log.info("查询建行预付款待更新交易状态结果集");
        List<TPayment> paymentList = paymentService.getPaymentToUpdateStatusByBankId(getCCBBankId(), getTaskTermDate(), "Y");
        ccbPrePaymentPushHandler.ccbPrePpaymentStatusPush(paymentList, EnumPushType.PAYMENT_PUSH.toString());
        return null;
    }

    @Override
    public String getTaskCode() {

        return EnumTaskCode.CCB_PRE_PAYMENT_STATUS_PUSH.toString();
    }
}
